﻿#pragma once
#ifndef _MAIN_GAME_H_
#define _MAIN_GAME_H_

#include "cocos2d.h"
#include "Box2D/Box2D.h"
#include "GLES-Render.h"
#include "MyContactListener.h"
#include "Define.h"
#include "BodyMaker.h"
#include "GunObject.h"
#include "BulletObject.h"
#include <vector>  
#include "2d/CCActionCamera.h"
class MainGame :public cocos2d::Layer
{
private:
	void initWorld();
	Sprite *mGameSprite,*mMenuSprite;
	CCTMXTiledMap *mMap;
	MyContactListener *mContactListener;
	b2World *mWorld;
	GunObject *mCurrentGun;
	int mVector;
	boolean mIsFight,mIsOver = false;
	MenuItem* pCloseItem;
	std::vector<GunObject*> mListGun;
	BulletObject *mBullet;
	boolean test = false;
	GLESDebugDraw * _debugDraw;
	SpriteBatchNode* spritebatch;
	SpriteFrameCache* cache;
public:
	MainGame();
	~MainGame();
	static void start();
	static void stop();
	static cocos2d::Scene* createScene();
	void MainGame::menuCloseCallback(Ref* pSender);
	virtual void update(float dt);
	virtual bool init();
	BaseObject* makeObjectFromId(int id, b2World* word);
	void loadMap();
	CREATE_FUNC(MainGame);
};
#endif//_MAIN_GAME_H_

